package com.zhen.Service_2;

import com.zhen.Mapper.StudentMapper;
import com.zhen.User.Fengye;
import com.zhen.User.Score;
import com.zhen.User.Student;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.aliyun.oss.OSS;
import com.aliyun.oss.OSSClient;
import org.springframework.stereotype.Component;
import org.springframework.web.multipart.MultipartFile;

import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.util.UUID;
import java.util.List;

@Service
public class Student2 implements Student01 {
    @Autowired
    private StudentMapper studentMapper;
    @Autowired
    private Fengye fengye;

    public List<Student> stselectall(){
        return studentMapper.selectStudent();
    }
    public Fengye stselectpage(Integer begin, Integer limit){
        List<Student> list=studentMapper.selectStudentpage(begin,limit);
        int count=studentMapper.countStudent();
        return fengye.fy(count,list);
    }
    //查询
    public Fengye stselectcha(Integer id,String name,String classroom,String sex,Integer begin, Integer end){
        List<Student> list=studentMapper.insertStudent(id, name, classroom, sex,begin,end);
        int count=studentMapper.countcha(id, name, classroom, sex);
        return fengye.fy(count,list);
    }
    public Integer deleteStudent(List<Integer> list){
        Integer del= studentMapper.delstudent(list);
        return del;
    }
    public Integer updateStudent(Student student){
       return studentMapper.updateStudent(student);
    }
    public Integer updateScore(Score score){
        return studentMapper.updateScore(score);
    }
    //添加
    public Integer insertStudent(Student student){
//        studentMapper.insertScore(student);
        return studentMapper.jiaStudent(student);
    }
    public Integer updatepwdstudent(Integer id){
        return studentMapper.updatePassword(id);
    }
    //查询成绩分页
    public Fengye scoreselect(Integer id,String name,String classroom,Integer begin, Integer limit){
        List<Score> scores=studentMapper.scoreselect(id,name,classroom,begin,limit);
        int count=studentMapper.countscore(id, name, classroom);
        return fengye.fy(count,scores);
    }
    public int studentcount(){
        int count=studentMapper.countStudent();
        return count;
    }
}
